<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">基础数据&nbsp;-&nbsp;车型组管理</li>
    </ol>
    
    <div class="ms-content-layout has-operation">

			<div class="ms-operation-bar no-margin no-bottom-border clearfix">
				<div class="ms-operation-group pull-right">
					<a href="${ctx.host}/model-groups/create" data-target="#create"
						data-toggle="modal" class="btn ms-btn ms-btn-blue"> <i
						class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;添加
					</a> <a href="${ctx.host}/model-groups/search" data-target="#search"
						data-toggle="modal" class="btn ms-btn ms-btn-blue"> <i
						class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;筛选
					</a>
				</div>
			</div>

			<table class="table table-hover ms-table">
				<thead>
					<tr>
						<th>序号</th>
						<th>中文名称</th>
						<th>英文名称</th>
						<th>是否冻结</th>
						<th class="text-center">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach var="modelGroup" items="${modelGroups}"
						varStatus="status">
						<tr>
							<td>${status.index+1}</td>
							<td>${modelGroup.chineseName}</td>
							<td>${modelGroup.englishName}</td>
							<c:if test="${!modelGroup.disabled}">
								<td>正常</td>
							</c:if>
							<c:if test="${modelGroup.disabled}">
								<td>冻结</td>
							</c:if>
							<td class="text-center"><a
								href="${ctx.host}/model-groups/${modelGroup.id}/edit "
								data-target="#edit" data-toggle="modal">编辑</a>&nbsp;&nbsp;
								<c:if test="${!modelGroup.disabled}">
									<a href="${ctx.host}/model-groups/${modelGroup.id}/freeze"
										data-target="#freeze" data-toggle="modal">冻结</a>
								</c:if> 
								<c:if test="${modelGroup.disabled}">
									<a href="${ctx.host}/model-groups/${modelGroup.id}/activate"
										data-target="#activate" data-toggle="modal">激活</a>
								</c:if> &nbsp;&nbsp; <a
								href="${ctx.host}/model-groups/${modelGroup.id}">详情</a>&nbsp;&nbsp;
							</td>
						</tr>
					</c:forEach>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="5" class="no-vertical-padding">
							<div class="pull-left">
								<jsp:include page="/WEB-INF/include/page.jsp">
									<jsp:param name="url" value="${ctx.host}/model-groups" />
									<jsp:param name="queryString" value="${queryString}" />
								</jsp:include>
							</div>
						</td>
					</tr>
				</tfoot>
			</table>

		</div>
	</div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/data/model-group-list.js" />
  <script type="text/javascript">
        require([ 'page/data/model-group-list' ], function(page) {
            page.init({
            	apiHost: "${config.apiHost}"
            });
        })
  </script>
</body>
</html>